from time import sleep

from selenium.webdriver.common.by import By

from base.base import Base


class MIDPage(Base):
    goods_manager = (By.XPATH, '//span[text()="商场管理"]')

    def gm_f(self):
        self.loc_wait_ele(self.goods_manager).click()

    bp = (By.XPATH, '//span[text()="关键词"]')

    def bp_f(self):
        self.loc_wait_ele(self.bp).click()

    ab = (By.XPATH, '//span[text()="删除"]')

    def ab_f(self):
        self.loc_wait_ele(self.ab).click()


    dialog = (By.CSS_SELECTOR, "body > div.el-notification.right > div > div.el-notification__content > p")

    def dialog_f(self):
        r = self.loc_wait_ele(self.dialog).text
        print("获取元素：", r)
        return r


    def mid_bus(self):
        self.gm_f()
        self.bp_f()
        self.ab_f()
        sleep(2)


        return self.dialog_f()